package com.uinnova.springboot.demo.mongodb.service;

import com.uinnova.springboot.demo.mongodb.User;
import com.uinnova.springboot.demo.mongodb.dao.UserMongo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 张攀钦
 * @date 2018-12-25-23:45
 * ${DES}
 */
@Service
public class UserService {
    @Autowired
    private UserMongo userMongo;

    public User getUserById(String id) {
        return userMongo.findById(id).get();
    }

    public User getUserByName(String name) {
        return userMongo.findFirstByName(name);
    }

    public User findFromName(String name) {
        return userMongo.findUserFromName(name);
    }
}
